package com.zb.service.impl;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zb.entity.ZjNetworkPath;
import com.zb.mapper.ZjNetworkPathMapper;
import com.zb.service.ZjNetworkPathService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 网点接口路径表 服务实现类
 * </p>
 *
 * @author WEN
 * @since 2023-10-18
 */
@Service
public class ZjNetworkPathServiceImpl extends ServiceImpl<ZjNetworkPathMapper, ZjNetworkPath> implements ZjNetworkPathService {

    // 保存或修改服务商接口路径及密钥
    @Override
    public void save(Long custAccId, Long id, String path, String publicKey) {
        if (StringUtils.isBlank(path) || StringUtils.isBlank(publicKey)) {
            return;
        }
        ZjNetworkPath networkPath = this.getById(id);
        if (null != networkPath) {
            networkPath.setPath(path);
            networkPath.setPublicKey(publicKey);
            this.updateById(networkPath);
            return;
        }
        networkPath = new ZjNetworkPath();
        networkPath.setId(id);
        networkPath.setCustAccId(custAccId);
        networkPath.setPath(path);
        networkPath.setPublicKey(publicKey);
        this.save(networkPath);
    }
}
